package com.amado.course03;

/**
 * 三元运算符
 * @author wangyl-910
 * @description
 * @date 2018/4/4
 * @see
 */
public class TernaryOperator {
    public static void main(String[] args) {
        int age=11;
        String printStr;
        if(age >=18){
            printStr = "成年了";
        }else{
            printStr = "未成年";
        }
        System.out.println(printStr);
        //改成三元运算
        printStr = age>18?"成年了":"未成年";
        System.out.println(printStr);
    }
}
